package com.hs.serial

import java.io.File

object TtyUtils {
    val ttys: List<String>
        get() {
            val ttys: MutableList<String> =
                ArrayList()
            val devDir = File("/dev")
            if (devDir.exists() && devDir.isDirectory) {
                val files = devDir.listFiles()
                if (files != null) {
                    for (file in files) {
                        val fileName = file.name
                        if (fileName.startsWith("tty")) {
                            ttys.add("/dev/$fileName")
                        }
                    }
                }
            }
            return ttys
        }
    val bRate = arrayListOf(9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600)
    const val K_LOCK_PATH = "K_LOCK_PATH"
    const val K_LOCK_RATE = "K_LOCK_RATE"
    const val K_READER_PATH = "K_READER_PATH"
    const val K_READER_RATE = "K_READER_RATE"

}
